package com.cx.base.day19_thread;

import lombok.extern.slf4j.Slf4j;

/**
 * @Author: robert.song
 * @Date: Created in 2021/8/3
 */
@Slf4j
public class Thread_5_Daemon {
    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            while (true) {
                if (Thread.currentThread().isInterrupted()) {
                    break;
                }
            }
            log.info("结束");
        }, "t1");
        t1.setDaemon(true);
        t1.start();
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        log.info("结束");
    }
}
